%!TeX program=xelatex
\documentclass[UTF8,fontset=none,scheme=chinese]{ctexart}
\usepackage[
    papersize={90mm,200mm},%根据手机尺寸比例设置
    hdivide={6mm,,6mm},%左边距，文本长度，右边距
    vdivide={12mm,,8mm},%上边距，文本高度，下边距
    headsep=1em,%调整页眉位置
    footskip=1.8em]{geometry}%纸张尺寸

\usepackage[table]{xcolor}
\colorlet{cox}{teal!70!black}
\colorlet{coi}{red!70!black}
\definecolor{eye}{RGB}{199,237,204}%护眼绿
\definecolor{xblue}{RGB}{1,126,218}%浅蓝色
\definecolor{eblue}{RGB}{20,50,104}
\newcommand{\btcolor}{xblue}%标题颜色
\pagecolor{eye}	%背景颜色
    
\usepackage{graphicx}
%可能的图片加载路径
\graphicspath{
    {./figure/}
    {./figures/}
    {./image/}
    {./images/}
    {./graphics/}
    {./graphic/}
    {./pictures/}
    {./picture/}
}

%背景图片，先根据手机尺寸先行调整图片大小比例
\usepackage{wallpaper}
%\CenterWallPaper{1}{tex/background.jpg}

\usepackage{easyReview}
%英文字体
\setmainfont{TeX Gyre Pagella}
\setsansfont{DejaVu Sans}
\setmonofont{DejaVu Sans Mono}

%文泉驿字体%%%%%%%%%%
\setCJKmainfont[AutoFakeBold,AutoFakeSlant]{FZFangSong-Z02}
\setCJKsansfont[AutoFakeBold,AutoFakeSlant]{FZHei-B01}
\setCJKmonofont[AutoFakeBold,AutoFakeSlant]{FZShuSong-Z01}
\setCJKfamilyfont{zhsong}[AutoFakeBold,AutoFakeSlant]{FZShuSong-Z01}
\setCJKfamilyfont{zhhei}[AutoFakeBold,AutoFakeSlant]{FZHei-B01}
\setCJKfamilyfont{zhkai}[AutoFakeBold,AutoFakeSlant]{FZKai-Z03}
\setCJKfamilyfont{zhfs}[AutoFakeBold,AutoFakeSlant]{FZFangSong-Z02}
\newcommand*{\songti}{\CJKfamily{zhsong}}% 宋体
\newcommand*{\heiti}{\CJKfamily{zhhei}}% 黑体
\newcommand*{\kaishu}{\CJKfamily{zhkai}}% 楷体
\newcommand*{\fangsong}{\CJKfamily{zhfs}}% 仿宋
%生僻字
\setCJKfamilyfont{spz}{Noto Serif CJK SC}	%给生僻字单独使用，其实上面的方正字体用不着这个

\usepackage{needspace}
%\setcounter{secnumdepth}{3}
%\setcounter{tocdepth}{2}
\ctexset{
    part={
        tocline=\CTEXifname{\thepart\hspace{0.5em}}{}#2,
        %		aftername=\par\vskip -1.5em~\\,
        format+=\color{red!70},
        break=\Needspace{\textheight},
    },
    section={
        break=\Needspace{\textheight},
        format=\color{\btcolor} \heiti,
        %		number=\chinese{section},
        %				name=\S,
        aftername=\hspace{0.5em},
    },
    subsection={
        format=\color{\btcolor} \kaishu,
        %		number=\arabic{subsection},
        %		name={,.},
        aftername=\hspace{0.5em},
        tocline=\CTEXifname{\CTEXthesubsection\hspace{0.5em}}{}#2,
    },
    subsubsection={
        format=\color{\btcolor} \fangsong,
        %		number=\arabic{subsubsection},
        %		name={(,)},
        aftername=\hspace{0.5em},
        tocline=\hspace{-1em}\CTEXifname{\CTEXthesubsubsection\hspace{0.5em}}{}#2,
    },
}
\renewcommand{\contentsname}{\Large\centerline{目\ \ 录}}


% 页眉页脚
\RequirePackage{fancyhdr,lastpage}
\fancypagestyle{subfancy}{%
    \fancyhf{}
    \lhead{\itshape\scriptsize{\rightmark}}
    \rhead{\scriptsize{\thepage/\pageref{LastPage}}}
    \renewcommand{\headrulewidth}{0pt}
}
\fancypagestyle{downfancy}{%
    \fancyhf{}
    \lhead{\itshape\scriptsize{\leftmark}}
    \rhead{\scriptsize{\thepage/\pageref{LastPage}}}
%    \rfoot{回\pageref{mulu}页}
    \renewcommand{\headrulewidth}{0pt}
}

%插入图片充满整页
%\usepackage{tikz}
%\newcommand\includefullbg[2][]{
%	\newpage
%	\thispagestyle{empty}
%	\begin{tikzpicture}[remember picture, overlay, inner sep=0pt]
%		\node at (current page.center) 
%		{\includegraphics[width=\paperwidth, height=\paperheight, keepaspectratio=false,#1]{#2}};
%	\end{tikzpicture}
%	\newpage
%}

\usepackage{verse}%诗歌相关
\usepackage{hyperref}%让pdf也能通过点击书签选择想看的章节
\hypersetup{bookmarksopen=true,bookmarksnumbered=true,breaklinks,colorlinks,urlcolor=coi,linkcolor=coi,pdfstartview=FitH}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\title{手机PDF电子书模板}
\author{Aniu}
\date{\today}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
	\sloppy	%防文本过长溢出
    \addcontentsline{toc}{section}{首页}
    \pagestyle{empty}
    \maketitle
    \thispagestyle{empty}
    \label{mulu}
    \tableofcontents
    \newpage
    \pagestyle{downfancy}
%    \setcounter{page}{1}

%%========正文========%%

%	\input{tex/序言}
%	\input{tex/第1章}
%%	\input{tex/第2章}

\renewcommand{\abstractname}{前\quad 言}%默认是“摘要”

\begin{abstract}    

我在手机上看pdf电子书时，有几个\alert{讨厌}的问题。

\begin{enumerate}
    \item 字体太小
    \item 页面大小跟手机尺寸不匹配
    \item 没有目录书签，不能快速跳转
\end{enumerate}
\end{abstract}

\section{小小的说明}
\subsection{生僻字}

设置：

{\zihao{6}
\begin{verbatim}
     \setCJKfamilyfont{spz}{Noto Serif CJK SC}
\end{verbatim}
}
使用时：\verb|{\CJKfamily{spz}炆}|。

但其实设置好字体，就用不上。

\subsection{文件的位置}
加载文本：
\begin{verbatim}
    \include{tex/序言}
\end{verbatim}

把主要文档内容都放到一个统一的文件夹（如tex）中，可以方便管理。

\section{一首小诗}
\centering
\poemtitle*{侠客行}{李白}
\settowidth{\versewidth}{赵客缦胡缨，吴钩霜雪明。}
\begin{verse}[\versewidth]
赵客缦胡缨，吴钩霜雪明。\\
银鞍照白马，飒沓如流星。\\
十步杀一人，千里不留行。\\
事了拂衣去，深藏身与名。\\
闲过信陵饮，脱剑膝前横。\\
将炙啖朱亥，持觞劝侯嬴。\\
三杯吐然诺，五岳倒为轻。\\
眼花耳热后，意气素霓生。\\
救赵挥金槌，邯郸先震惊。\\
千秋二壮士，烜赫大梁城。\\
纵死侠骨香，不惭世上英。\\
谁能书阁下，白首太玄经。\\   
\end{verse}
\end{document}